package ldh.im.fxbase.util;

import javafx.application.Platform;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class FxThreadUtil {
    private static final Logger LOGGER = LoggerFactory.getLogger(FileUtil.class);

    public static void runLater(Runnable runnable) {
        if (Platform.isFxApplicationThread()) {
            runnable.run();
            return;
        }
        Platform.runLater(()->{
            try {
                runnable.run();
            } catch (Exception e) {
                LOGGER.error("Platform Exception", e);
            }
        });
    }
}
